1. Field of the Invention
The present invention relates to an encoding apparatus using variable length encoding and, more particularly, to code amount control.
2. Related Background Art
In recent years, commercial VTRs for encoding an image signal with high efficiency, and recording/reproducing the encoded image signal on/from a recording medium such as a magnetic tape have been proposed.
As a technique for compressing and encoding an image signal with high efficiency, an encoding apparatus using orthogonal conversion is known. In this apparatus, after an image is divided into blocks (to be referred to as discrete cosine transform (DCT) blocks hereinafter) each consisting of a predetermined number of pixels, the DCT blocks are subjected to orthogonal conversion such as DCT conversion, and converted DCT coefficients are quantized to perform, e.g., entropy encoding.
As a method of high-efficiency encoding, a variable length encoding method with a high compression ratio tends to be used.
When data is recorded on a recording medium using variable length codes, it is desirable that a predetermined number of DCT blocks have a constant information amount in consideration of a special reproduction mode, error propagation, and the like.
A conventional encoding apparatus will be described below.
FIG. 1 is a block diagram of a conventional encoding apparatus. Note that two-dimensional DCT conversion is performed in units of small-size blocks each consisting of 8 pixels (horizontal).times.8 pixels (vertical) of an image signal, and the information amount is controlled to be constant in units of large-size blocks each consisting of 30 DCT blocks.
Referring to FIG. 1, a sample value of an image signal is input from an input terminal 1, and a large-size block forming circuit 2 selects 30 DCT blocks as a large-size block from 1-frame data according to an arbitrary rule.
This image signal is then supplied to a small-size block forming circuit 3, and is divided into small-size blocks each consisting of 8.times.8 pixels.
A sample value of the image signal divided into the small-size blocks is input to an orthogonal conversion circuit 4, and the small-size blocks are DCT-converted, thus outputting 64 conversion coefficients in units of small-size blocks.
The conversion coefficients are stored in a buffer circuit 5 in units of large-size blocks, and are also supplied to a code amount calculation circuit 7. The code amount calculation circuit 7 calculates the code amount of each large-size block upon encoding, and outputs the calculation result to a quantizer selection circuit 8.
The quantizer selection circuit 8 selects a quantizer (or a quantization table) which can achieve a predetermined code amount, i.e., a code amount equal to or smaller than a target code amount, in accordance with the input result.
A quantizer 6 quantizes the conversion coefficients delayed by the buffer circuit 5 using the quantizer selected by the quantizer selection circuit 8. The quantized conversion coefficients are subjected variable length encoding such as Huffman encoding by a variable length encoding circuit 9, and the encoded data are output from an output terminal 10.
The conventional problems will be explained below with reference to FIGS. 2A and 2B.
FIGS. 2A and 2B show the relationship among a code amount achieved by a finally selected quantizer Q.sub.n, a code amount achieved by a quantizer Q.sub.n-1 smaller by one than the quantizer Q.sub.n, and a target code amount. In FIGS. 2A and 2B, arrows a and b respectively represent the differences between the target code amount and the code amounts achieved by the quantizers Q.sub.n and Q.sub.n-1. More specifically, when data is quantized by the quantizer Q.sub.n, the code amount is smaller by a than the target code amount. When data is quantized by the quantizer Q.sub.n-1, the code amount exceeds the target code amount by b.
In the case of FIG. 2A, the value a is small, and encoding efficiency is high. However, in the case of FIG. 2B, the code amount is smaller by a considerably large value a than the target code amount, and encoding efficiency is low. In this case, the quantizer Q.sub.n-1 is to be selected if possible. However, since the code amount quantized by the quantizer Q.sub.n-1 slightly exceeds the target code amount by b, the quantizer Q.sub.n must be selected. In this manner, in the conventional apparatus, encoding with high efficiency cannot always be performed.
Conventional code amount control does not consider the visual characteristics of man. For example, the visual characteristics of man have steep discrimination characteristics for a relatively bright fine image, but have low identification ability for a dark fine image. Therefore, in the conventional control wherein the same quantization processing is performed for high-frequency components of low-luminance image data and those of middle- or high-luminance image data, high-frequency noise appears in a portion having a low luminance and a high degree of fineness, resulting in a visual obstacle.
Also, since the visual characteristics of man are lowered with respect to a moving image, image quality can be averaged by assigning a larger information amount to blocks with a small movement than blocks with a large movement. However, since the conventional method does not consider any movement, the above-mentioned control cannot be performed.